/**      
 * @file		strcpy_s.cpp
 * @description	This sample demonstrates the use of 
 *				strcpy_s(). This function only works with
 *				VS 2005. The function is in the ISO but not
 *				in the ansi standard. This removes issues with
 *				stack overflow that occur with strcpy. You should
 *				examine why you get a stack overflow with strcpy.
 *				Why is that bad???
 *				ONLY WORKS ON WINDOWS!!!!!
 * @course		CSCI 123 Section 00000
 * @assignment 
 * @date		mm/dd/yyyy
 * @author		Brad Rippe (00000000) brippe@fullcoll.edu
 * @version		1.0
 */
#include <iostream>
#include <string.h> // strcpy_s()
using namespace std;

/**
 * @return zero if the application executes successfully
 */
int main() {
	char cString1[] = "Please email my message to the class!";
	char cString2[] = "";

	cout << "This application demonstrates how to copy cstrings\n";
	cout << "Remember we can't use the assignment operator, = to assign";
	cout << " cstrings values unless we use it when we declare the cstring\n";
	cout << "Here is a sample of strcpy_s()\n";
	cout << "cString1 = " << cString1 << endl;
	cout << "cString2 = " << cString2 << endl;
	cout << "Now we'll use strcpy(destination, source) to copy cString1 to cString2\n";
	cout << "strcpy_s(cString2, cString1);\n";
	strcpy_s(cString2, cString1);
	cout << "cString1 = " << cString1 << endl;
	cout << "cString2 = " << cString2 << endl;
	// What happens with this code?
	// strcpy_s doesn't allow the copy to occur and
	// aborts the application

	return 0;
}

